/**
 * ************************************************************
 * 说明: 指北针错误数据清洗脚本，操作浏览器模拟人工点击按钮，执行保存操作
 * 作者: zhangtianyu
 * 版本: v1.0.1
 * 发布日期: 2024-01-11
 * ************************************************************
 */
require('sqlite3');

const config = require('./config/config.json');
const { BrowserTool } = require('./BrowserTool');
const { DatabaseTool } = require('./DatabaseTool');
const { Task } = require('./Task');
const { Builder } = require('./builder');
const CLI = require('./cli');

function exector() {
	const exector = (async () => {
		const databaseTool = new DatabaseTool(config.sqlite);
		const browserTool = new BrowserTool(config.zq_property);
		const task = new Task(databaseTool, browserTool);

		const program = {
			Task: task,
			DatabaseTool: databaseTool,
			Builder: Builder
		};

		const exector = CLI(program);

		exector.parseAsync();

		return exector;
	})();

	return exector;
}

module.exports = exector;